/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vamprest;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author sav
 */
@Entity
@Table(name = "theme")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Theme.findAll", query = "SELECT t FROM Theme t"),
    @NamedQuery(name = "Theme.findByIdtheme", query = "SELECT t FROM Theme t WHERE t.idtheme = :idtheme")})
public class Theme implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "idtheme")
    private Integer idtheme;
    @Lob
    @Size(max = 65535)
    @Column(name = "imguri")
    private String imguri;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "description")
    private String description;
    @Column(name = "sortorder")
    private int sortorder;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idtheme")
    private Collection<Poi> poiCollection;

    public Theme() {
    }

    public Theme(Integer idtheme) {
        this.idtheme = idtheme;
    }

    public Theme(Integer idtheme, String description) {
        this.idtheme = idtheme;
        this.description = description;
    }

    public int getSortorder() {
        return sortorder;
    }

    public void setSortorder(int sortorder) {
        this.sortorder = sortorder;
    }

    public Integer getIdtheme() {
        return idtheme;
    }

    public void setIdtheme(Integer idtheme) {
        this.idtheme = idtheme;
    }

    public String getImguri() {
        return imguri;
    }

    public void setImguri(String imguri) {
        this.imguri = imguri;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Poi> getPoiCollection() {
        return poiCollection;
    }

    public void setPoiCollection(Collection<Poi> poiCollection) {
        this.poiCollection = poiCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtheme != null ? idtheme.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Theme)) {
            return false;
        }
        Theme other = (Theme) object;
        if ((this.idtheme == null && other.idtheme != null) || (this.idtheme != null && !this.idtheme.equals(other.idtheme))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vamprest.Theme[ idtheme=" + idtheme + " ]";
    }

}
